import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

public class CrashReport {

    static class CrashHandler implements Thread.UncaughtExceptionHandler {

        @Override
        public void uncaughtException(Thread t, Throwable e) {
            System.out.println("tagged msg:"+e.getMessage());
            try {
                URL url = new URL("https://news-at.zhihu.com/api/4/news/before/20171214");
                URLConnection connection = url.openConnection();
                InputStream stream = connection.getInputStream();


            } catch (MalformedURLException e1) {
                e1.printStackTrace();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    }


    static class CrashReporter {
        private static CrashReporter INSTANCE;

        static {
            INSTANCE = new CrashReporter();
        }

        public static CrashReporter getInstance() {
            return INSTANCE;
        }


    }

    public static void main(String[] args) {
        Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());

        System.out.println(1 / 0);
    }
}
